package com.yfqy.app.domain.mapper;

import com.yfqy.app.domain.entity.PromotionRule;
import com.yfqy.app.modules.promotion.vo.PromotionRuleVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface PromotionRuleMapper {

    int insertBatch(@Param("promotionRules") List<PromotionRule> promotionRules);

    /**
     * 通用的
     */
    List<PromotionRule> selectByPromotionId(@Param("promotionId") Long id);

    /**
     * 折扣、特价、拼团专用
     */
    PromotionRule selectOnePromotionRule(@Param("promotionId") Long id, @Param("ruleType") Byte ruleType);

    /**
     * 满减专用
     */
    List<PromotionRule> selectFullDiscountRules(@Param("promotionId") Long id);

    int batchUpdate(@Param("toUpdate") List<PromotionRule> toUpdate);

    int batchDelete(@Param("batchDelete") List<Long> toDelete);

    List<PromotionRuleVO> selectByPromotionIds(@Param("promotionIds") List<Long> promotionIds);
}